package com.xiaotu.service.my.impl;


import cn.hutool.core.bean.BeanUtil;
import com.xiaotu.dao.common.CommonMapper;
import com.xiaotu.service.my.MyService;
import com.xiaotu.vo.WxUserPhoneVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author zhangxiao
 * @create 2021-08-19 17:21
 */
@Service
public class MyServiceImpl implements MyService<WxUserPhoneVo> {

    @Autowired
    private CommonMapper commonMapper;

    @Override
    public WxUserPhoneVo getWxUserPhonVo(Integer userId) {
        WxUserPhoneVo vo = new WxUserPhoneVo();
        BeanUtil.copyProperties(commonMapper.getWxUserPhoneDto(userId), vo);
        if (commonMapper.getErrorCorrectionTip())
            vo.setErrorCorrectionTip(true);
        if (vo.getIsCommentAuth() == 1 && commonMapper.getCommentApproveTip()) {
            vo.setCommentApproveTip(true);
        }
        if (commonMapper.getMyCommentMsgTip())
            vo.setMyCommentMsgTip(true);
        if (commonMapper.getMyLeaveMsgTip())
            vo.setMyLeaveMsgTip(true);
        vo.setMyConcernNum(commonMapper.getMyConcernNum(userId));
        vo.setMyFansNum(commonMapper.getMyFansNum(userId));
        return vo;
    }

}
